
clear 
use  "data_auctions_outcomes"

*** labels 
	lab var criminal_PA_group1 "Investigated PA"
	lab var criminal_admin_group1 "Investigated RUP"
	lab var criminal_firm_group1 "investigated Firm"
	lab var discret_crimadmin "Discr. Auction, Investigated RUP "
	lab var discret_nocrimadmin "Discr. Auction, clear RUP"
	lab var connected "Connected"
	lab var convicted_firm "Convicted Firm"
	la var discretproc_highn "$DiscretProc_{highN}$"
	lab var discret "Discretion"
	lab var discretcrit "DiscretCrit"
	lab var discretproc "DiscretProc$_{lowN}$" 
	lab var extra_pct_init "ExtraCost wrt base"
	lab var extra_pct "ExtraCost wrt winning bid"
	label var n_imprese_offerenti  "No. Bidders"
	label var n_invited_offers "No. Invited Bidders"
	lab var firstprice "Price Only Auction"
	label var discount_winner "Winning discount"
	label var negoziata "DiscretProc"
	label var contractual_duration "Contractual Duration"
	label var delay "Delay"
	label var asinh_delay "Delay (Asinh)"
	label var importo_iniziale "Reserve Price"
	label var importo_iniziale2 "Reserve Price (mil)"
	lab var og1 "OG1"
	lab var og3 "OG3"
	la var urgency "Urgency"
	la var maintainance "Maintenance"
	la var category_type "Category"
	lab def area 2 "Center" 1 "North" 3 "South"
	lab val Area area 
	lab var tot_auctions "Total N. Auctions, by PA"
	lab var tot_value "Total Value (in bil), by PA"
*** Table 1 
{
eststo clear 
eststo: estpost sum criminal_admin_group1  criminal_firm_group1 discret discret_crimadmin discret_nocrimadmin  if area == 3
eststo: estpost sum criminal_admin_group1  criminal_firm_group1 discret  discret_crimadmin discret_nocrimadmin  if area == 2
eststo: estpost sum criminal_admin_group1  criminal_firm_group1 discret  discret_crimadmin discret_nocrimadmin  if area == 1

esttab  using "auction-summ_byarea.tex", replace label cell(mean(fmt(a3)) sd(par)) fragment booktabs nostar  collabels(none) noobs nonote mtitles("South"  "Center" "North") 

}
*** Table 2 
{
	
	eststo clear 
global vars discret discretcrit discretproc discretproc_highn negoziata firstprice criminal_firm_group1 criminal_admin_group1  n_imprese_offerenti n_invited_offers importo_iniziale2 discount_winner extra_pct_init contractual_duration  delay
global cityvars criminal_PA_group1  Aread1 Aread2 Aread3 tot_auctions tot_value  PA_typed* Populationd*

** PANEL A 

eststo Y: qui estpost summarize $vars  if criminal_PA_group1 !=. , d // outcomes
esttab Y using "summ_auction.tex", replace fragment booktabs unstack noobs nomtitles  wrap varwidth(20) alignment(ccc) cells("mean(fmt(%9.2fc) label(Mean)) p50(fmt(%9.2fc) label(Median)) sd(fmt(%9.2fc) label(S.D.)) count(fmt(%9.0fc) label(N))") label substitute(\_ _)

** PANEL B 
	eststo city: estpost summ $cityvars if citytag ==1  , d

	esttab city  using "summ_city.tex", replace fragment booktabs unstack noobs nomtitles  wrap varwidth(20) alignment(ccc) cells("mean(fmt(%9.2fc) label(Mean)) p50(fmt(%9.2fc) label(Median)) sd(fmt(%9.2fc) label(S.D.)) count(fmt(%9.0fc) label(N))")  label 

}

*** Table 3

{
preserve
keep if citytag == 1
g count_PA = _N 
count if tot_auctions > 1 
g count_PAid = r(N)
foreach var in discret discretcrit discretproc{
count if tot_`var' > 0 & tot_`var'!=. & tot_auctions > 1 
g count_`var' = r(N)
gen dummy_sd_`var' = (sd_`var' !=. & sd_`var' > 0)
lab var dummy_sd_`var'  "Var. in `var'"
}
eststo clear 
foreach var in discret discretcrit discretproc{
count if sd_`var' !=. & sd_`var' > 0 
g sd_count_`var' = r(N)
}

eststo clear 
eststo all: estpost summ count_* sd_count_* 
drop count_* sd_count* 
keep if n_istat110 !=. 
forvalue x = 1/3 {
count if Area == `x'
g count_PA = r(N)
count if tot_auctions > 1 & Area == `x'
g count_PAid = r(N)
foreach var in discret discretcrit discretproc{
count if tot_`var' > 0 & tot_`var'!=. & tot_auctions > 1  & Area == `x'
g count_`var' = r(N)
}

foreach var in discret discretcrit discretproc{
count if sd_`var' !=. & sd_`var' > 0 & Area == `x'
g sd_count_`var' = r(N)
}
la var count_PA "Total PAs" 
la var count_PAid "Total PA, $>$ 1 Auction"
la var count_discretproc "At least 1 DiscretProc_{lowN}"
la var count_discretcrit "At least 1 DiscretCrit"
la var count_discret "At least 1 Discret"
la var sd_count_discretproc "PA w. Variance in DiscretProc_{lowN} "
la var sd_count_discretcrit "PA w. Variance DiscretCrit"
la var sd_count_discret "PA w. Variance in Discret"
eststo city`x': estpost summ count_* sd_count_*  
}
	esttab all  city3 city2 city1 using "${basedir}/tex-files/dfp/summ_identification.tex", replace fragment booktabs unstack noobs  wrap varwidth(50) alignment(ccc) cells("mean(fmt(%9.0fc) label( ))")  label collabels(none) mtitles("" "South" "Center" "North") mgroups("All PAs" "Cities", pattern(1 1 0 0 )  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
 restore 
}

 
*** Table 4
{
global rhs1 = "discret"
global rhs2 = "discretcrit discretproc"
lab var log_importo_iniziale  "Reserve Price (ln)"
global importo_iniziale log_importo_iniziale 
gen maintainance = regexm(oggetto, "manutenzion")
global contr_type maintainance urgency category_type 

global fe id_city year bin_importo  $contr_type
global cl id_city
	label var criminal_firm_group1 "investigated firm"
la var negoziata "DiscretProc$_{highN}$"
foreach i in 1{
	label var criminal_firm_group`i' "Investigated Firm"

eststo clear
	eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
	
			eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 



eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
		eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

		

esttab using "criminalfirm`i'_discret.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitles mgroups("all" "cities", pattern(1 0 0 0 0 1 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
}
}



*** Table 5
{
global fe  id_regi bin_importo year
eststo clear 
global pop ln_pop ln_pop2
eststo: reghdfe discret criminal_admin_group1, absorb(id_city bin_importo year $contr_type) cluster(id_city)
format discret %9.2f 
		summ discret if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "PA"
eststo: reghdfe discretproc criminal_admin_group1 , absorb(id_city bin_importo year $contr_type) cluster(id_city)
format discretproc %9.2f 
		summ discretproc if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "PA"
eststo: reghdfe discretcrit criminal_admin_group1 , absorb(id_city bin_importo year $contr_type) cluster(id_city)
format discretcrit %9.2f 
		summ discretcrit if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "PA"
eststo: reghdfe discret criminal_admin_group1 , absorb(id_regi bin_importo year $contr_type) cluster(id_city)
		format discret %9.2f 
		summ discret if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Region"

eststo: reghdfe discret criminal_PA_group1 , absorb(id_regi bin_importo year $contr_type) cluster(id_city)
format discret %9.2f 
		summ discret if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Region"
eststo: reghdfe discret criminal_admin_group1 criminal_PA_group1 , absorb(id_regi bin_importo year $contr_type) cluster(id_city)
summ discret if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Region"
	eststo: reghdfe discretproc criminal_admin_group1 criminal_PA_group1 , absorb(id_regi bin_importo year $contr_type) cluster(id_city)
summ discretproc if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Region"
eststo: reghdfe discretcrit criminal_admin_group1 criminal_PA_group1 , absorb(id_regi bin_importo year $contr_type) cluster(id_city)
summ discretcrit if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Region"

esttab using "auction-level_discretion_choice.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3)  label wrap  varwidth(20) modelwidth(4) stats(mean N r2 FE, label("Dep. Var. Mean" "Observations" "R-sq" "Geog. FE")) drop( *cons) se brackets numbers  substitute(\_ _)
}


*** Table 6 
{
foreach var in asinh_delay discount_winner  extra_pct_init {


eststo clear
	eststo: reghdfe `var' discretcrit $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe `var' discretproc $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe `var' discretcrit discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe `var' discretcrit discretproc negoziata $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
	
			eststo: reghdfe `var' discret negoziata $importo_iniziale , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 



eststo: reghdfe `var' discretcrit $importo_iniziale if  n_istat110 !=. , absorb($fe) cluster(id_city)
format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe `var' discretproc $importo_iniziale if  n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe `var' discretcrit discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe `var' discretcrit discretproc negoziata $importo_iniziale if  n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
		eststo: reghdfe `var' discret negoziata $importo_iniziale if  n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

		

esttab using "`var'.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitles mgroups("all" "cities", pattern(1 0 0 0 0 1 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
}
}

***************** APPENDIX ***************** 

*** Table A1 
{
*  Panel A 

eststo clear 
eststo: estpost sum criminal_firm_group1 criminal_admin_group1  discret discret_crimadmin discret_nocrimadmin if og3==1
eststo: estpost sum criminal_admin_group1  criminal_firm_group1 discret  discret_crimadmin discret_nocrimadmin if og1==1

esttab  using "auction-summ_bysector.tex", replace label cell(mean(fmt(a3)) sd(par)) fragment booktabs nostar  collabels(none) noobs nonote mtitles("Roads"  "Buildings") 

* Panel B
eststo clear 
eststo: estpost sum criminal_admin_group1  criminal_firm_group1 local_firm  discret discret_crimadmin discret_nocrimadmin if local_rup==1
eststo: estpost sum criminal_admin_group1  criminal_firm_group1 local_firm discret  discret_crimadmin discret_nocrimadmin  if local_rup==0

esttab  using "auction-summ_bylocal.tex", replace label cell(mean(fmt(a3)) sd(par)) fragment booktabs nostar  collabels(none) noobs nonote mtitles("Local"  "Not Local") 

} 

*** Table A2 
{
eststo clear 
foreach var in asinh_delay discount_winner  extra_pct_init {

	eststo: reghdfe `var' connected discret $importo_iniziale, absorb($fe) cluster($cl)
		format `var' %9.2f 
		summ `var', format
		scalar mean = r(mean)
		estadd scalar mean 
	eststo: reghdfe `var' connected discretproc discretcrit $importo_iniziale, absorb($fe) cluster($cl)
		format `var' %9.2f 
		summ `var', format
		scalar mean = r(mean)
		estadd scalar mean 
	eststo: reghdfe `var' connected discretcrit discretproc negoziata $importo_iniziale, absorb($fe) cluster($cl)
		format `var' %9.2f 
		summ `var', format
		scalar mean = r(mean)
		estadd scalar mean 
		
}
esttab using "auction-level_discret_outcomes_connected.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets  nomtitle mgroups("Delay (Asinh)" "Winning Discount" "Extra Cost", pattern(1 0 0 1 0 0 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
}
*** Table A3 and A4
{
global rhs1 = "discret"
global rhs2 = "discretcrit discretproc"
lab var log_importo_iniziale  "Reserve Price (ln)"
global importo_iniziale log_importo_iniziale 
global fe id_city year bin_importo  $contr_type
global cl id_city
	label var criminal_firm_group1 "investigated firm"
la var negoziata "DiscretProc$_{highN}$"
foreach i in 2 4{
	label var criminal_firm_group`i' "Investigated Firm"

eststo clear
	eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
	
			eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 



eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
		eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

		

esttab using "criminalfirm`i'_discret.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitles mgroups("all" "cities", pattern(1 0 0 0 0 1 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
}
}

*** Table A5 
{
label var convicted_firm "Convicted Firm"
eststo clear
{
	eststo: reghdfe convicted_firm  discretcrit $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ convicted_firm if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe convicted_firm  discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ convicted_firm if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe convicted_firm  discretcrit discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ convicted_firm if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe convicted_firm  discretcrit discretproc negoziata $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ convicted_firm if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
	
			eststo: reghdfe convicted_firm  discret negoziata $importo_iniziale , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ convicted_firm if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 



eststo: reghdfe convicted_firm  discretcrit $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
format criminal_firm_group1 %9.2f 
		summ convicted_firm if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe convicted_firm  discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ convicted_firm if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe convicted_firm discretcrit discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ convicted_firm if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe convicted_firm  discretcrit discretproc negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ convicted_firm if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		
		eststo: reghdfe convicted_firm  discret negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ convicted_firm if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 

		

esttab using "convictedfirm_discret.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo* *cons) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets  nomtitles mgroups("all" "cities", pattern(1 0 0 0 0 1 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _) nocons


}
}
*** Table A6 
{
global fe id_city##year bin_importo  $contr_type

forvalues i=1/1 {
	label var criminal_firm_group`i' "Investigated Firm"

eststo clear
	eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
	
			eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 



eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
		eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

		

esttab using "criminalfirm`i'_discret_paxyear.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitles mgroups("all" "cities", pattern(1 0 0 0 0 1 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
}
}
*** Table A7
{
global if if importo_iniziale > 150000
forvalues i=1/1 {
	label var criminal_firm_group`i' "Investigated Firm"

eststo clear
	eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
	
			eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale $if, absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 



eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale $if &  n_istat110 !=. , absorb($fe) cluster(id_city)
format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale $if & n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale $if & n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale $if & n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
		eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale $if & n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

		

esttab using "criminalfirm`i'_discret_above150.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitles mgroups("all" "cities", pattern(1 0 0 0 0 1 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
}
}
*** Table A9 
{
gen treated = importo_iniziale > 500000 & importo_iniziale < 1000000
replace treated = . if importo_iniziale <= 500000 
gen post = year>=2011 & data_pubblicazione >= mdy(5,13,2011)
la var treated "Treated"
la var post "Post2011 Reform"

global fe id_city year  $contr_type
global if if importo_iniziale > 500000

forvalues i=1/1 {
	label var criminal_firm_group`i' "Investigated Firm"

eststo clear
	eststo: reghdfe criminal_firm_group`i' treated##post  $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i'  treated##post##discret  $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
			eststo: reghdfe criminal_firm_group`i' treated##post##discret  $importo_iniziale $if & criminal_admin_group1 == 0 , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
				eststo: reghdfe criminal_firm_group`i' treated##post##discret  $importo_iniziale $if & criminal_admin_group1 == 1 , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
replace treated = . if importo_iniziale > 950000 & importo_iniziale < 1050000
replace treated = . if importo_iniziale > 500000 & importo_iniziale < 550000
		
		
	eststo: reghdfe criminal_firm_group`i' treated##post  $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i'  treated##post##discret  $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
			eststo: reghdfe criminal_firm_group`i' treated##post##discret  $importo_iniziale $if & criminal_admin_group1 == 0 , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
				eststo: reghdfe criminal_firm_group`i' treated##post##discret $importo_iniziale $if & criminal_admin_group1 == 1 , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 




esttab using "criminalfirm`i'_discret_tc.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo* *0.*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitles mgroups("standard" "donut", pattern(1 0 0  0 1 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
}
}

*** Table A10 
{
global importo_iniziale log_importo_iniziale 

forvalues i=1/1 {
	label var criminal_firm_group`i' "Investigated Firm"

eststo clear
	eststo: reghdfe criminal_firm_group`i' criminal_admin_group1  $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit criminal_admin_group1 $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

		
	eststo: reghdfe criminal_firm_group`i' discretproc criminal_admin_group1 $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
				

	eststo: reghdfe criminal_firm_group`i'  negoziata criminal_admin_group1 $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
	
			eststo: reghdfe criminal_firm_group`i' discret negoziata criminal_admin_group1 $importo_iniziale , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

eststo: reghdfe criminal_firm_group`i' criminal_admin_group1 criminal_PA_group1 $importo_iniziale, absorb(id_regi bin_importo year $contr_type) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit criminal_admin_group1 criminal_PA_group1 $importo_iniziale, absorb(id_regi bin_importo year $contr_type) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

		
	eststo: reghdfe criminal_firm_group`i' discretproc criminal_admin_group1 criminal_PA_group1 $importo_iniziale, absorb(id_regi bin_importo year $contr_type) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
				

	eststo: reghdfe criminal_firm_group`i'  negoziata criminal_admin_group1 criminal_PA_group1 $importo_iniziale, absorb(id_regi bin_importo year $contr_type) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
	
			eststo: reghdfe criminal_firm_group`i' discret negoziata criminal_admin_group1 $importo_iniziale , absorb(id_regi bin_importo year $contr_type) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

		

esttab using "criminalfirm`i'_discret_rupv2.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitles mgroups("PA FE" "Region FE", pattern(1 0 0 0 0 1 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)


}

}
*** Table A11 
{
global fe  id_prov bin_importo year $fe $contr_type
eststo clear 
eststo: reghdfe discret criminal_admin_group1  , absorb(id_city bin_importo year $contr_type) cluster(id_city)
format discret %9.2f 
		summ discret, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "PA"
eststo: reghdfe discretproc criminal_admin_group1  , absorb(id_city bin_importo year $contr_type) cluster(id_city)
format discret %9.2f 
		summ discret, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "PA"
eststo: reghdfe discretcrit criminal_admin_group1  , absorb(id_city bin_importo year $contr_type) cluster(id_city)
format discret %9.2f 
		summ discret, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "PA"
eststo: reghdfe discret criminal_admin_group1  , absorb(id_prov  bin_importo year $contr_type) cluster(id_city)
		format discret %9.2f 
		summ discret, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Province"

eststo: reghdfe discret criminal_PA_group1, absorb(id_prov  bin_importo year $contr_type) cluster(id_city)
format discret %9.2f 
		summ discret, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Province"
eststo: reghdfe discret criminal_admin_group1 criminal_PA_group1 , absorb(id_prov bin_importo year $contr_type) cluster(id_city)
summ discret, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Province"
	eststo: reghdfe discretproc criminal_admin_group1 criminal_PA_group1  , absorb(id_prov  bin_importo year $contr_type) cluster(id_city)
summ discretproc, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Province"
eststo: reghdfe discretcrit criminal_admin_group1 criminal_PA_group1 , absorb(id_prov  bin_importo year $contr_type) cluster(id_city)
summ discretcrit, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Province"

		esttab using "auction-level_discretion_choice_prov.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3)  label wrap  varwidth(20) modelwidth(4) stats(mean N r2 FE, label("Dep. Var. Mean" "Observations" "R-sq" "Geog. FE")) se brackets numbers  substitute(\_ _)
} 
*** Table A12 
{
global fe  id_regi bin_importo year
gen negcond = negoziata==1 & discret== 0 
lab var negcond "negotiated, non-discret "
eststo clear 
eststo: reghdfe negoziata criminal_admin_group1  , absorb(id_city bin_importo year $contr_type) cluster(id_city)
format negoziata %9.2f 
summ negoziata if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "PA"
eststo: reghdfe negoziata criminal_admin_group1  , absorb($fe $contr_type) cluster(id_city)
		format negoziata %9.2f 
summ negoziata if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Region"

eststo: reghdfe negoziata criminal_PA_group1   , absorb($fe $contr_type) cluster(id_city)
format negoziata %9.2f 
summ negoziata if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Region"
eststo: reghdfe negoziata criminal_admin_group1 criminal_PA_group1 , absorb($fe $contr_type) cluster(id_city)
format negoziata %9.2f 
summ negoziata if e(sample)==1, format
		scalar mean = r(mean)
		estadd scalar mean 
		estadd local FE "Region"

esttab using "auction-level_discretion_choice_appendix.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3)  label wrap  varwidth(20) modelwidth(4) stats(mean N r2 FE, label("Dep. Var. Mean" "Observations" "R-sq" "Geog. FE")) se brackets numbers substitute(\_ _)
} 
*** Table A13
{
global fe id_city year bin_importo  $contr_type
global fe2  id_regi year bin_importo  $contr_type 

eststo clear 
foreach var in asinh_delay discount_winner  extra_pct_init {
	cap drop sample
cap drop nomiss_`var'
gen nomiss_`var' = `var' !=. 
global if if criminal_firm_group1 !=. & criminal_admin_group1 !=. & criminal_PA_group1 !=. & id_regi !=. & id_city!=. 

	eststo: reghdfe miss_`var' criminal_firm_group1 $importo_iniziale $if , absorb($fe) cluster($cl)
		format miss_`var' %9.2f 
		summ miss_`var', format
		scalar mean = r(mean)
		estadd scalar mean 
	eststo: reghdfe miss_`var' criminal_admin_group1 $importo_iniziale $if , absorb($fe) cluster($cl)
		format miss_`var' %9.2f 
		summ miss_`var', format
		scalar mean = r(mean)
		estadd scalar mean 
		gen sample = e(sample) ==1 
			eststo: reghdfe miss_`var' criminal_PA_group1 $importo_iniziale $if & sample==1, absorb($fe2) cluster($cl)
		format miss_`var' %9.2f 
		summ miss_`var', format
		scalar mean = r(mean)
		estadd scalar mean 
		
}
esttab using "auction-level_discret_outcomes_sample.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitle mgroups("Delay (Asinh)" "Winning Discount" "Extra Cost", pattern(1 0 0 1 0 0 1 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
}
*** Table A14 
{
forvalues i=1/1 {
preserve 
keep if extra_pct != . & asinh_delay !=. & discount_winner !=. 
	label var criminal_firm_group`i' "Investigated Firm"

eststo clear
	eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
	
			eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 



eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
		eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1 if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

		

esttab using "criminalfirm`i'_discret_small.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitles mgroups("all" "cities", pattern(1 0 0 0 0 1 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
}
}

*** Table A15 
{
foreach var in asinh_delay discount_winner  extra_pct_init {
	global if if asinh_delay !=. & extra_pct_init !=. & discount_winner !=. 

eststo clear
	eststo: reghdfe `var' discretcrit $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe `var' discretproc $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
			summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe `var' discretcrit discretproc $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
			summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe `var' discretcrit discretproc negoziata $importo_iniziale $if, absorb($fe) cluster($cl)
	format criminal_firm_group1 %9.2f 
			summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
	
			eststo: reghdfe `var' discret negoziata $importo_iniziale $if, absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
			summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 



eststo: reghdfe `var' discretcrit $importo_iniziale $if &  n_istat110 !=. , absorb($fe) cluster(id_city)
format criminal_firm_group1 %9.2f 
			summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe `var' discretproc $importo_iniziale $if & n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
			summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe `var' discretcrit discretproc $importo_iniziale $if & n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe `var' discretcrit discretproc negoziata $importo_iniziale $if & n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 
		
		eststo: reghdfe `var' discret negoziata $importo_iniziale $if & n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ `var' if e(sample)==1, format

		scalar mean = r(mean)
		estadd scalar mean 

		

esttab using "`var'_small.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitles mgroups("all" "cities", pattern(1 0 0 0 0 1 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)

}
}
*** Table A16 
{
eststo clear 
foreach var in asinh_delay discount_winner  extra_pct_init{

	eststo: reghdfe `var' discret criminal_firm_group1 criminal_admin_group1 $importo_iniziale, absorb($fe) cluster($cl)
		format `var' %9.2f 
		summ `var', format
		scalar mean = r(mean)
		estadd scalar mean 
	eststo: reghdfe `var' discretproc discretcrit criminal_firm_group1 criminal_admin_group1 $importo_iniziale, absorb($fe) cluster($cl)
		format `var' %9.2f 
		summ `var', format
		scalar mean = r(mean)
		estadd scalar mean 
	eststo: reghdfe `var' discretcrit discretproc negoziata criminal_firm_group1 criminal_admin_group1 $importo_iniziale, absorb($fe) cluster($cl)
		format `var' %9.2f 
		summ `var', format
		scalar mean = r(mean)
		estadd scalar mean 
		
}
esttab using "auction-level_discret_crim_outcomes.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo*) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets  nomtitle mgroups("Delay (Asinh)" "Winning Discount" "Extra Cost" , pattern(1 0 0 1 0 0 1 0 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)
}
*** Table A8 
{
	** bidder-level data 
use "data_bidder_auctions_outcomes.dta", clear
keep if n_istat110 !=.
gen maintainance = regexm(oggetto, "manutenzion")
global contr_type maintainance urgency category_type 


eststo clear 
	global fe cf_amm year bin_importo  $contr_type

eststo: qui reghdfe  criminal_bidder_group1 discretcrit   $imp $if, absorb($fe) cluster(cf_amm)
su criminal_bidder_group1 if e(sample) == 1
estadd scalar r(mean)

eststo: qui reghdfe  criminal_bidder_group1  discretproc  $imp $if,   absorb($fe) cluster(cf_amm)
su criminal_bidder_group1 if e(sample) == 1
estadd scalar r(mean)

eststo: qui reghdfe criminal_bidder_group1 discretcrit discretproc  $imp $if, absorb($fe) cluster(cf_amm)
su criminal_bidder_group1 if e(sample) == 1
estadd scalar r(mean)

eststo: qui reghdfe  criminal_bidder_group1  discretcrit discretproc negoziata  $imp $if, absorb($fe) cluster(cf_amm)
su criminal_bidder_group1 if e(sample) == 1
estadd scalar r(mean)

eststo : qui reghdfe  criminal_bidder_group1 discret  negoziata     $imp $if, absorb($fe) cluster(cf_amm)
su criminal_bidder_group1 if e(sample) == 1
estadd scalar r(mean)

**** now re-run main sample regression for the bidder sample
keep cig year
duplicates drop
merge 1:1 cig year using "$basedir/dati/analysis/dfp/data_auctions_outcomes_PAOLO.dta", update replace
keep if _m == 3 
drop _m
	egen discret=rowmax(belowmin scorerule)
	gen discretcrit=scorerule==1
	gen discretproc=belowmin==1
	rename maschi0femmine pop
	foreach var in pop{
gen ln_`var'=log(`var')
	forvalues t=2/3 {
		gen ln_`var'`t'=ln_`var'^`t'
	}
	}
egen id_city=group(cf_ammin)
gen maintainance = regexm(oggetto, "manutenzion")
global contr_type maintainance urgency category_type 
		lab var discret "Discretion"
	lab var discretcrit "DiscretCrit"
	lab var discretproc "DiscretProc_{lowN}" 
	label var criminal_firm_group1 "investigated firm"
	
g log_importo_iniziale=log(importo_iniziale)
global rhs1 = "discret"
global rhs2 = "discretcrit discretproc"
lab var log_importo_iniziale  "Reserve Price (ln)"
global importo_iniziale log_importo_iniziale 
global fe id_city year bin_importo  $contr_type
global cl id_city
	label var criminal_firm_group1 "investigated Winner"
	local i = 1
eststo: reghdfe criminal_firm_group`i' discretcrit $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1, format
		scalar mean = r(mean)
		estadd scalar mean 
		

	eststo: reghdfe criminal_firm_group`i' discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1, format
		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1, format
		scalar mean = r(mean)
		estadd scalar mean 
		
	eststo: reghdfe criminal_firm_group`i' discretcrit discretproc negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1, format
		scalar mean = r(mean)
		estadd scalar mean 
		
		eststo: reghdfe criminal_firm_group`i' discret negoziata $importo_iniziale if n_istat110 !=. , absorb($fe) cluster(id_city)
	format criminal_firm_group1 %9.2f 
		summ criminal_firm_group1, format
		scalar mean = r(mean)
		estadd scalar mean 

	
esttab using "bidder-level_all.tex", replace fragment booktabs star(* .1 ** .05 *** .01) b(a3) se(a3) label wrap drop(*importo* $imp) varwidth(20) modelwidth(4) stats(mean N r2, label("Dep. Var. Mean" "Observations" "R-sq")) se brackets nomtitles mgroups("participant" "auction" , pattern(1 0 0 0 0 1 0 0 0 0)  prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span})) substitute(\_ _)

} 


